{ "cells": [ { "cell_type": "markdown", "source": [ "# Making Weapons\n", "## Problem Definition\n", "Din Djarin is a retired bounty hunter that now runs a small factory specialised in making classic weapons in a colony recently re-established in Mandalore. The factory manufactures two different types of weapons, swords and spears. Din uses special alloys, mixtures of metals and rare materials, which have made a name for the endurance of his weapons across the colony. The table below shows the weight in pounds of each material needed to make each type of weapon:\n", "\n", "| Metal | spear | sword |\n", "|----------|-------|-------|\n", "| Beskar | 1 | 0.5 |\n", "| Tungsten | 1 | 1 |\n", "| Titanium | 3 | 1 |\n", "\n", "And the table below shows the total amount of each metal available, also in pounds: \n", "\n", "| Metal | Amount |\n", "|----------|--------|\n", "| Beskar | 125 |\n", "| Tungsten | 225 |\n", "| Titanium | 300 |\n", "\n", "The price of a spade is 40 credits and the price of a sword is 5 credits. Din has already sold 100 swords, so he needs to manufacture at least that many. \n", "\n", "**Find the optimal number of spades and swords that maximise revenues**" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "## Model" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "The objective is to maximise the revenues obtained with the sales of both types of weapons. \n", "The objective function can be modeled as:\n", "\n", "$\\max z = 40x_{1} + 5x_{2}$\n", "\n", "where z represents the objective variable (profits) and the decision variables are:\n", "\n", "\n", "- $x_{1}$: units of spears\n", "\n", "- $x_{2}$: units of swords\n", "\n", "Let us for now consider that they are real and non-negative. \n", "\n", "The objective function is subject to the following constraints:\n", "\n", "Metal availability constraints: \n", "\n", "$x_{1} + 0.5x_{2} \\leq 125$\n", "\n", "$x_{1} + x_{2} \\leq 225$\n", "\n", "$3x_{1} + x_{2} \\leq 300$\n", "\n", "And the demand on swords:\n", "\n", "$x_{2} \\geq 100$\n", "\n", " \n" ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } } } ], "metadata": { "colab": { "name": "CLP assignment.ipynb", "provenance": [] }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" }, "pycharm": { "stem_cell": { "cell_type": "raw", "source": [], "metadata": { "collapsed": false } } } }, "nbformat": 4, "nbformat_minor": 1 }